#include <strings.h>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdlib>
#include "BaseMining.h"
#include "TestflowMining.h"
#include "Symtab.h"

using namespace std;

BaseMining *BaseMining::tables[2] = {NULL, NULL};
char * BaseMining::tnames[2] = {"Testflow", "INMC"};

void BaseMining::init()
{
	int i;
      	for(i = 0; i < 2; i++)
       	{
    		tables[i] = NULL;
      	}
      	tnames[0] = "Testflow";
       	tnames[1] = "INMC";
   	
}

BaseMining* BaseMining::getMiningInstance(const char *store)
{
  int i;
      	for(i = 0; i < 2; i++)
      	{
       		if(strcasecmp(store,tnames[i]) == 0)
     		{
      			switch(i)
    			{
    				case 0: if(tables[i] == NULL)
     					{
    						tables[i] = new TestFlow();
     						return tables[i];
     					}
     					else
     						return tables[i];
       			}
       		}
      	}
      	return NULL;	
}

 
void BaseMining::cleanUp()
{
    int i;
    for(i = 0; i < 2; i++)
	{
		if(tables[i] != NULL)
			delete tables[i];
	}
}

//Virtual Destructor
BaseMining::~BaseMining()
{}

